<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <meta http-equiv="X-UA-Compatible" content="ie=edge">
    <title>Document</title>
    <script type="text/javascript">
    window.onload=function(){
        var parents=document.getElementById("myDiv");
        var Id=parents.getAttribute("id");
        var Title=parents.getAttribute("title");
        var Class=parents.getAttribute("class");
        var Lang=parents.getAttribute("lang");
        var Div=parents.getAttribute("div-Attribute");

        alert("id="+Id+" "+"title="+Title+" "+"class="+Class+" "+"lang="+Lang+" "+"div-Attribute="+Div);
        
    }
    </script>
</head>
<body>
    <div id="myDiv" class="TextColor" title="文本盒子" lang="zh-cn" div-Attribute="自己定义的一个属性">这是一个div内容</div>
</body>
</html>